<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>地图导航</title>
    <style>
        *{
            margin:0;
            padding:0;
        }

        #container{
            width:100%;
            height:100vh;
            background-color:pink;
        }
    </style>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
    window._AMapSecurityConfig = {
      securityJsCode: "600b5682bf15b1e20d7f106dea517249",
    };
</script>
<script
        type="text/javascript"
        src="https://webapi.amap.com/maps?v=2.0&key=7b6757ecd338a17d7c96431180d54a9d"
></script>
<script type="text/javascript">

    var zoom = 18
    var map = new AMap.Map("container", {
      zoom: zoom,
      center:[116.397658,39.908028] ,
    });


    function setLocation(lon, lat){
        map.setZoomAndCenter(zoom, [lon, lat])

        var marker = new AMap.Marker({
            map: map,
            icon: "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
            position: [lon, lat]
        });
        map.add(marker)

        map.plugin(['AMap.PlaceSearch'], function() {
            var PlaceSearchOptions = {
                map:map,
                pageSize: 8,
                pageIndex: 1,
                extensions: "base"
            };
            var MSearch = new AMap.PlaceSearch(PlaceSearchOptions);
            AMap.Event.addListener(MSearch, "complete",(result)=>{

                  window.driver.receiveNearPlace(JSON.stringify(result.poiList.pois))

            });
            MSearch.searchNearBy("停车场", [lon, lat]);
        });
    }

    window.onload=function(){

        window.driver.setCurrentLocation()
    }
</script>
</body>
</html>

